package com.a3dweijing.wetouch2.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.a3dweijing.wetouch2.Common.CallBack;
import com.a3dweijing.wetouch2.Common.RefreshRecycler.CommonrRecyclerAdapter;
import com.a3dweijing.wetouch2.Common.RefreshRecycler.ViewHolder;
import com.a3dweijing.wetouch2.R;
import com.a3dweijing.wetouch2.Util.GlideUtil;
import com.a3dweijing.wetouch2.bean.EvaluatedDate;
import com.a3dweijing.wetouch2.bean.GoodsListBean;
import com.a3dweijing.wetouch2.bean.OrderListBean;

import java.util.List;

/**
 * Created by Administrator on 2018/4/2.
 */

public class EvaluatedListAdapter extends CommonrRecyclerAdapter
{


    public EvaluatedListAdapter(Context context, List datas) {
        super(context, datas);
    }

    public EvaluatedListAdapter(Context context, List datas, CallBack callBack) {
        super(context, datas, callBack);
    }

    @Override
    public void convert(RecyclerView.ViewHolder holder, final Object o)
    {
        
        ViewHolder holder1 = (ViewHolder)holder;
        OrderListBean item = (OrderListBean)o;
        LinearLayout evaluate_list_item = holder1.getView(R.id.evaluate_list_item);
        ImageView imageView = holder1.getView(R.id.img);
        TextView shopping_name = holder1.getView(R.id.shopping_name);
        TextView num = holder1.getView(R.id.num);
        TextView all_money = holder1.getView(R.id.all_money);
        GlideUtil.getInstance().showImage(mContext, item.getGoods_imgurl(), imageView);
        shopping_name.setText(item.getGoods_name());
        num.setText("x" + item.getGoods_number() + "");
        all_money.setText(item.getGoods_money() + "");
        if (callBack != null)
        {
            View.OnClickListener onClickListener = new View.OnClickListener()
            {
                @Override
                public void onClick(View view)
                {
                    callBack.doNext(view.getId(), o);
                }
            };
            evaluate_list_item.setOnClickListener(onClickListener);
        }
    }
    
    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
    {
        return ViewHolder.get(mContext, parent, R.layout.evaluated_list_item, viewType);
    }
}
